package com.example.demoMybatis.controller;

import com.example.demoMybatis.domain.Student;
import com.example.demoMybatis.mapper.StudentMapper;
import com.example.demoMybatis.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.io.IOException;
import java.util.List;

@Controller
public class DemoController {

    @Autowired
    private StudentService studentService;

    @Autowired
    private StudentMapper studentMapper;

    @GetMapping("/")
    @ResponseBody
    public ResponseEntity<List<Student>> test() {
        List<Student> students = studentMapper.selectList(null);
        return ResponseEntity.ok(students);
    }


}
